package cmd

import (
	"github.com/spf13/cobra"
	global2 "longmen/server/config/global"
	"longmen/server/internal/services/nami/config"
	"longmen/server/pkg/db/mysql/models/models_sports"
)

var initSharding = &cobra.Command{
	Use:   "init_sharding",
	Short: "初始化表分区,足球，篮球 指数",
	Long:  "初始化表分区",
	Run: func(cmd *cobra.Command, args []string) {
		err := global2.SportSharding().AutoMigrate(
			models_sports.BasketballOdds{},
			models_sports.FootballOdds{},
		)
		if err != nil {
			global2.Log.Error("初始化失败：", err)
		}
	},
	PreRun: func(cmd *cobra.Command, args []string) {
		global2.Initialize(configFile)
		config.InitConfig()
	},
	PostRun: func(cmd *cobra.Command, args []string) {

	},
}
